package com.example.dwr.gidemo.bus;

import java.util.Iterator;
import java.util.List;
import jsx3.xml.CdfDocument;
import jsx3.xml.Record;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ConvertedCountries
{
  private Countries countries;
  private static Log log = LogFactory.getLog(ConvertedCountries.class);

  public ConvertedCountries()
  {
    this.countries = new Countries();
  }

  public CdfDocument getCountries()
  {
    CdfDocument document = new CdfDocument("root");

    int index = 1;
    for (Iterator i$ = this.countries.getCountries().iterator(); i$.hasNext(); ) { Country country = (Country)i$.next();

      document.appendRecord(new Record(country.getId()).setAttribute("index", String.valueOf(index++)).setText(country.getName()));
    }

    log.info("XML=" + document.toXml());
    return document;
  }
}